package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.Complaints;
import cn.gson.crm.model.service.ComplaintsService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/ComplaintsController")
public class ComplaintsController {
    @Autowired
    ComplaintsService complaintsService;
    @RequestMapping("/ContractMethod")
    @ResponseBody
    public Map<String,Object> selectcom(HttpSession session, Integer cid, Integer page, Integer size){

        return complaintsService.selectcom(session,cid,page,size);
    };
    //条件查询
    @RequestMapping("/ContractMethod1")
    @ResponseBody
    public Map<String,Object> selectwhere( HttpSession session,Integer cid, String where,Integer page, Integer size){

        return complaintsService.selectwhere(session,cid,where,page,size);
    };
    //根据时间查询
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    public Map<String,Object> selecttime(HttpSession session, Integer cid, String statr, String endtime,Integer page, Integer size){
        return complaintsService.selecttime(session,cid,statr,endtime,page,size);
    };
    //新增
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    public void  savecom(@RequestBody  Complaints complaints){
        complaintsService.savecom(complaints);
    }
}
